import js from "npm:@eslint/js@9";
import globals from "npm:globals@15";

export default [
    js.configs.recommended,
    {
        languageOptions: {
            ecmaVersion: 2022,
        },
        rules: {
            "arrow-parens": ["error", "as-needed"],
            "arrow-spacing": ["error", { before: true, after: true }],
            "block-scoped-var": "error",
            "brace-style": ["error", "1tbs", { allowSingleLine: false }],
            "comma-dangle": ["error", "always-multiline"],
            "comma-style": ["error", "last"],
            "eol-last": ["error", "always"],
            "eqeqeq": "error",
            "func-call-spacing": ["error", "never"],
            "guard-for-in": "error",
            "key-spacing": ["error", { beforeColon: false, afterColon: true, mode: "strict" }],
            "keyword-spacing": ["error", { before: true, after: true }],
            "linebreak-style": ["error", "unix"],
            "max-len": ["error", { code: 100, tabWidth: 4 }],
            "no-alert": "error",
            "no-confusing-arrow": "error",
            "no-const-assign": "error",
            "no-debugger": "error",
            "no-div-regex": "error",
            "no-dupe-args": "error",
            "no-dupe-else-if": "error",
            "no-dupe-keys": "error",
            "no-duplicate-case": "error",
            "no-ex-assign": "error",
            "no-fallthrough": "error",
            "no-floating-decimal": "error",
            "no-implicit-globals": "error",
            "no-implied-eval": "error",
            "no-import-assign": "error",
            "no-invalid-regexp": "error",
            "no-label-var": "error",
            "no-lonely-if": "error",
            "no-mixed-operators": "error",
            "no-multi-assign": "error",
            "no-return-assign": "error",
            "no-script-url": "error",
            "no-self-compare": "error",
            "no-sequences": "error",
            "no-template-curly-in-string": "error",
            "no-trailing-spaces": "error",
            "no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
            "no-var": ["error"],
            "prefer-arrow-callback": ["error"],
            "prefer-const": ["error"],
            "quotes": ["error", "double"],
            "semi": ["error", "always"],
            "space-before-blocks": "error",
            "space-before-function-paren": ["error", "never"],
            "space-infix-ops": "error",
        },
    },
    {
        files: ["static/**/*", "templates/**/*"],
        languageOptions: {
            globals: globals.browser,
        },
    },
    {
        files: ["gui-tests/**/*"],
        languageOptions: {
            globals: globals.node,
        },
    },
];
